Contents ----- Copyright Up Previous Next

Get Size Of Images

Several browsers support the attributes WIDTH and HEIGHT for tags like <IMG>. If you know the exact size of your image, you can tell it the browser. This might speed up the layout-engine, because the browser doesn't have to wait for the image to be transfered or needs to re-layout the page after the transfer.

Usage

As you usually don't know the exact size of your images, let your stupid computer handle that tricky task by enabling the switch GETSIZE when invoking hsc. This will hsc tell to analyse the image the attribute SRC refers to, and append the attributes WIDTH and HEIGHT with the dimensions obtained from the image data.

If you have already set those attributes yourself, hsc will only validate the values, and warn about mismatches.

Example

Take a look at this nice picture of some nice guy: Picture of some nice guy

This can usually be included in a document using
<IMG SRC="image/niceguy.gif" ALT="Picture of some nice guy">
but if a document called niceguy.hsc is converted using
hsc niceguy.hsc TO niceguy.html GETSIZE
the <IMG>-tag seen above will be extended to
<IMG SRC="image/niceguy.gif" ALT="Picture of some nice guy" WIDTH="64" HEIGHT="64">
in the html-object. If you do not like the double quotes assigned to the size values, use the CLI-option QUOTESTYLE to change this behavior.

Supported Image Formats

In the recent years several formats to store image data have been established - mostly because none of these was really useful. Only a few of them are supported by hsc. However these should be enough for w3-authoring.

gif - Graphics Interchange Format

In the early times of w3, this was the only format supported by most browsers. It features only indexed-color (16 or 256 colors) and an ugly looking progressive display option. It became very popular in a negative sense because of it's compression algorithm and the associated copyright.

Bye the way, did you know that "The Graphics Interchange Format(c) is the Copyright property of CompuServe Incorporated. GIF(sm) is a Service Mark property of CompuServe Incorporated."? So now you do; if it makes them happy...

jfif/jpeg

Essentially this format does a good job as an idiot indicator. This already starts with the name: jfif is short for JPEG File Interchange Format (because it uses jpeg compression for image data). Nevertheless jfif-pictures will have a file extension set to ``.jpg'' or ``.jpeg''.

The main feature about jpeg compression is that it is lossy, which means that the output image is not identical to the input image. Documents about software using jpeg compression usually claim that you can obtain good compression levels with no visible change. As long as you do not start to rotate or apply other complex image processing operations on pictures, this might even be true. Otherwise an ugly grid will appear soon.

Most important jfif is commonly used to encode images of more or less undressed people. To store as many such pictures as possible on as less space as possible, the compression rate is usually set to a high value. This makes these people look if they are suffered by leprosy or just a drawing by Egon Schiele.

Furthermore many people outside English speaking countries pronounce jpeg (``jay-peg'') as GPEG (``gee-peg''), even if they are normally capable of proper English pronunciation.

PNG - Portable Network Graphics

The PNG Specification (http://www.w3.org/pub/WWW/TR/WD-png) claims this format to be
...an extensible file format for the lossless, portable, well-compressed storage of raster images. PNG provides a patent-free replacement for the GIF format and can also replace many common uses of TIFF format. Indexed-color, grayscale, and truecolor images are supported, plus an optional alpha channel. Sample depths range from 1 to 16 bits. PNG is designed to work well in online viewing applications, such as the World Wide Web, and so it is fully streamable with a progressive display option.

Above all PNG supports most obvious things several other formats failed to include. There is nothing really remarkable about it, but today one has the be glad even about this. So it can be said that PNG is one of the view positive things that happened in the last ten years.

But even despite that their is free source code available to read PNG-images, and the word ``Network'' is part of it's name (to conform to the hype), only few applications and w3-browsers support it for now.